#!/bin/bash
# TEST SUITE 6
# Set-up: 3 middle man with 1 queue, 1 postgresql server
# Purpose: Try to measure the performances of the system with 1 databases and 3 middle-men


# CONFIGURATION BEGINS HERE

# the folder where results should be stored (relative to home)
results_folder='mockup_3m_1s'

middle_man_host1='dryad12.inf.ethz.ch'
middle_man_host2='dryad13.inf.ethz.ch'
middle_man_host3='dryad14.inf.ethz.ch'
db_host='dryad15.inf.ethz.ch'
#duration in minutes
duration=1




# AUTOMATIC ITERATION BEGINS HERE
if [ ! -d $results_folder ]; then
	mkdir $results_folder
fi
L=100
P=1

for C in 1 #8 16 32 48 64 96
do
	for M in 2 #4
	do
		out_file_path="$results_folder/c"$C"_p"$P"_l"$L"_m"$M".raw"
		if [ ! -f $out_file_path ]; then
			middle_man1_config="{{middle_man:$middle_man_host1};{{P:$P},{L:$L},{M:$M},{database:$db_host}}}"
			middle_man2_config="{{middle_man:$middle_man_host2};{{P:$P},{L:$L},{M:$M},{database:$db_host}}}"
			middle_man3_config="{{middle_man:$middle_man_host3};{{P:$P},{L:$L},{M:$M},{database:$db_host}}}"      			
			args="$C $duration $out_file_path 3 $middle_man1_config $middle_man2_config $middle_man3_config"
			./client.sh $args
		fi
	done
done